package com.wzh.provicer.service.impl;

import com.wzh.core.annotation.RpcProvider;
import com.wzh.api.entity.User;
import com.wzh.api.service.UserService;
import jakarta.annotation.Resource;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;

/**
 * @description:
 * @author: wangzouhuax
 */
@RpcProvider
@Service
public class UserServiceImpl implements UserService {

    @Resource
    private Environment env;

    @Override
    public User getUser(String name) {
        return new User(1, name, 18, "北京" + System.currentTimeMillis());
    }

    @Override
    public User getUser(Integer id, String name) {
        return new User(id, name, 20, "北京" + System.currentTimeMillis());
    }

    @Override
    public User findById(Integer id) {
        String property = env.getProperty("server.port");
        return new User(id, "wzh" + property, 20, "北京" + System.currentTimeMillis());
    }

    @Override
    public long findLongId(long id) {
        return id;
    }

    @Override
    public User findUser(User user) {
        return user;
    }
}
